#pragma once
#include "particles\Emitter.h"
#include "Font.h"
#include "SGD Wrappers\SGD_Declarations.h"
#include "anim\AnimationManager.h"
#include <string>

class CIMenuState;

class Game
{
private:
	Game() = default;
	~Game() = default;

	static Game*	s_pInstance;
	CIMenuState*	m_pCurrState = nullptr;
	CAnimationManager * pAnim;
	
	unsigned long m_ulGameTime = 0;

	float m_fScreenWidth;
	float m_fScreenHeight;

	float m_fWorldWidth = 1;
	float m_fWorldHeight = 1;
	float m_fElapsedTime;

	bool m_bminigame = false;

	SGD::Point CameraPosition = { 0, 0 };

	std::string m_szPath;

	bool fullscreen = false;

	Font* m_pFont = nullptr;	

	SGD::HAudio tunes			= SGD::INVALID_HANDLE;
	SGD::HAudio m_hGameSong		= SGD::INVALID_HANDLE;
	SGD::HAudio creatureatk		= SGD::INVALID_HANDLE;
	SGD::HAudio creaturedie		= SGD::INVALID_HANDLE;
	SGD::HAudio creaturegrowl	= SGD::INVALID_HANDLE;
	SGD::HAudio m_hScore		= SGD::INVALID_HANDLE;
	SGD::HAudio hit				= SGD::INVALID_HANDLE;
	SGD::HAudio sprinting		= SGD::INVALID_HANDLE;
	SGD::HAudio menu			= SGD::INVALID_HANDLE;
	SGD::HAudio boom			= SGD::INVALID_HANDLE;
	SGD::HAudio powerup			= SGD::INVALID_HANDLE;
	SGD::HAudio punchhit		= SGD::INVALID_HANDLE;
	SGD::HAudio punchmiss		= SGD::INVALID_HANDLE;
	SGD::HAudio tackle			= SGD::INVALID_HANDLE;
	SGD::HAudio dash			= SGD::INVALID_HANDLE;
	SGD::HAudio throwing		= SGD::INVALID_HANDLE;
	SGD::HAudio exhausted		= SGD::INVALID_HANDLE;
	SGD::HAudio death			= SGD::INVALID_HANDLE;
	SGD::HAudio walking			= SGD::INVALID_HANDLE;





	SGD::HTexture Arrow			= SGD::INVALID_HANDLE;
	SGD::HTexture m_hDarkSmoke	= SGD::INVALID_HANDLE;
	SGD::HTexture m_hLightSmoke = SGD::INVALID_HANDLE;
	SGD::HTexture m_hMedSmoke	= SGD::INVALID_HANDLE;

	static void MessageProc(const SGD::Message* pMsg);

	float darkOffset = 0;
	float medOffset = 50;
	float lightOffset = 635;

public:
	static Game*	GetInstance(void);
	static void		DeleteInstance(void);
	
	bool Initialize(float width, float height);
	int	 Update(void);
	void Terminate(void);

	float GetScreenWidth(void)  const	{ return m_fScreenWidth; }
	float GetScreenHeight(void) const	{ return m_fScreenHeight; }

	float GetWorldWidth(void)	const	{ return m_fWorldWidth; }
	float GetWorldHeight(void)  const	{ return m_fWorldHeight; }	
	unsigned long GetGameTime() const	{ return m_ulGameTime; }
	bool GetMiniGame(){ return m_bminigame; }
	void SetMiniGame(bool m){ m_bminigame = m; }
	int indexDelete = 0;

	void SetSavePath(std::string path){ m_szPath = path; }
	std::string GetSavePath() const { return m_szPath; }

	SGD::Point	GetCameraPos(void) const	{ return CameraPosition; }
	void SetCameraPos(SGD::Point p) 		{ CameraPosition = p; }

	bool GetFullscreen() { return fullscreen; }
	void SetFullscreen(bool f) { fullscreen = f; }
	
	//CEmitter emit1;
	//CEmitter emit2;
	//CParticleManager* pParticleSys;

	// Accessors
	SGD::HAudio Getbkgrmusic()		{ return tunes; }
	SGD::HAudio Getcreatureatk()	{ return creatureatk; }
	SGD::HAudio Getcreaturedie()	{ return creaturedie; }
	SGD::HAudio Getcreaturegrowl()	{ return creaturegrowl; }
	SGD::HAudio Gethit()			{ return hit; }
	SGD::HAudio GetScoreSound()		{ return m_hScore; }
	SGD::HAudio GetSpriting()		{ return sprinting; }
	SGD::HAudio GetMenusound()		{ return menu; }
	SGD::HAudio GetBoomSound()		{ return boom; }
	SGD::HAudio GetPowerupSound()	{ return powerup; }	
	SGD::HAudio GetPunchhitSound()	{ return punchhit; }
	SGD::HAudio	GetPunchmissSound()	{ return punchmiss; }
	SGD::HAudio	GetTackleSound()	{ return tackle; }
	SGD::HAudio	GetDashSound()		{ return dash; }
	SGD::HAudio	GetThrowingSound()	{ return throwing; }
	SGD::HAudio	GetExhaustedSound()	{ return exhausted; }
	SGD::HAudio	GetDeathSound()		{ return death; }
	SGD::HAudio	GetWalkingSound()	{ return walking; }
	SGD::HAudio		GetMenuMusic()		{ return tunes; }
	SGD::HAudio		GetGameMusic()		{ return m_hGameSong; }	
	SGD::HTexture	GetArrow()			{ return Arrow; }
	SGD::HTexture	GetLightSmoke()		{ return m_hLightSmoke; }
	SGD::HTexture	GetMedSmoke()		{ return m_hMedSmoke; }
	SGD::HTexture	GetDarkSmoke()		{ return m_hDarkSmoke; }
	float			GetElapsedTime()	{ return m_fElapsedTime; }
//Mutators

	// Smoke Offset Functions
	float LightOff();
	float MedOff();
	float DarkOff();

	
	//Mutators

	void ChangeState(CIMenuState* pNewState);

	const Font*	GetFont(void) const	{ return m_pFont; }	 
};

